package com.lhf.userservice.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lhf.userservice.dao.FvsSysRoleDao;
import com.lhf.userservice.entity.FvsSysRole;
import com.lhf.userservice.service.FvsSysRoleService;
import com.lhf.userservice.vo.FvsSysAddPerForRoleVo;
import com.lhf.userservice.vo.FvsSysRoleVO;
import com.lhf.userserviceapi.dto.FvsSysRoleDTO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (FvsSysRole)表服务实现类
 *
 * @author liuhf
 * @since 2021-03-29 16:01:55
 */
@Service("fvsSysRoleService")
public class FvsSysRoleServiceImpl extends ServiceImpl<FvsSysRoleDao, FvsSysRole> implements FvsSysRoleService {


    @Resource
    private FvsSysRoleDao fvsSysRoleDao;

    /**
     * 查询用户所有角色
     *
     * @param uid
     * @return
     */
    @Override
    public List<FvsSysRoleVO> findAllByUid(Long uid) {
        return this.fvsSysRoleDao.findAllByUid(uid);
    }

    /**
     * 为角色添加权限
     *
     * @param vo
     * @return
     */
    @Override
    public Boolean addPerForRole(FvsSysAddPerForRoleVo vo) {
        return this.fvsSysRoleDao.addPerForRole(vo) > 0;
    }

    /**
     * 删除角色权限
     *
     * @param vo
     * @return
     */
    @Override
    public Boolean delPerForRole(FvsSysAddPerForRoleVo vo) {
        return this.fvsSysRoleDao.delPerForRole(vo) > 0;
    }


    @Override
    public List<FvsSysRoleDTO> findRoleByPath(String path) {
        return this.fvsSysRoleDao.findRoleByPath(path);
    }
}
